from http import HTTPStatus
import dashscope

dashscope.api_key="sk-c173650c330c4cf0bbe36b8b0fbc3183"

def tokenizer():
    response = dashscope.Generation.call(
        model='qwen-turbo',
        prompt="写一篇800字左右带图片的失恋情感短文",
        seed=1234,
        top_p=0.8,
        result_format='message',
        enable_search=False,
        max_tokens=1500,
        temperature=0.85,
        repetition_penalty=1.0
    )
    if response.status_code == HTTPStatus.OK:
        print(response)
    else:
        print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (
            response.request_id, response.status_code,
            response.code, response.message
        ))


if __name__ == '__main__':
    tokenizer()
